<template>
    <div>
        <div class="w">
            <t-header></t-header>

            <div class="new-wrap">
                <div
                :key="index"
                @click="getInfo(item.id)"
                v-for="(item, index) in newMusic" 
                class="new-item">
                    <div class="mask">
                        <div class="ico">
                            <i class="iconfont">&#xe682;</i>
                            <div>{{item.name}}</div>
                        </div>
                    </div>
                    <img :src="item.picUrl">
                </div>
            </div>

        </div>


        <t-footer></t-footer>
    </div> 
</template>

<script>
import Header from '../components/Header'
import Footer from '../components/Footer'
export default {
    components: {
        't-header': Header,
        't-footer': Footer
    },
    data() {
        return {
            // 获取参数
            params: {
                limit: 32,
                offset: 0
            },
            // 新碟
            newMusic: []
        }
    },
    mounted() {
        this.getNewMusic();
    },
    methods: {
        // 获取新碟
        async getNewMusic() {
            let { data: res } = await this.$http.get('/top/album', { params: { ...this.params } });
            this.newMusic = res.albums;
        },
        // 获取新碟专辑信息
        async getInfo() {
            this.$message.error('新碟上架url接口，网易云没有对外开放！');
        }
    } 
}
</script>

<style lang="less" scoped>
.new-wrap {
    margin-top: 60px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    .new-item {
        position: relative;
        width: 23%;
        margin: 0 10px;
        cursor: pointer;
        margin-bottom: 20px;
        &:hover .mask {
            display: block;
        }
        img {
            width: 100%;
            height: 100%;
        }
        .mask {
            display: none;
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, .4);
            .ico {
                position: absolute;
                left: 50%;
                top: 50%;
                transform: translate(-50%, -50%);
                text-align: center;
                color: #fff;
                i {
                    font-size: 50px;
                }
                div {
                    padding-top: 12px;
                }
            }
        }
    }
}
</style>